<template>
  <div id="edit">
    <div class="el_content">
      <el-row class="edit-title">
        <el-col :span="4">基本信息</el-col>
        <el-col :span="2" :push="18" class="text-right">
          <el-button
            class="back"
            type="info"
            size="mini"
            plain
            icon="el-icon-arrow-left"
            @click="goBack"
          >返回</el-button>
        </el-col>
      </el-row>
      <div class="detail">
        <el-row class="el_t_20">
          <el-col :span="3" class="el-name">姓名：</el-col>
          <el-col :span="6">胡忠信
            <el-button type="text" style="margin-left:20px;">查看详细病例》</el-button>
          </el-col>
          <el-col :span="3" class="el-name">性别：</el-col>
          <el-col :span="5">男</el-col>
          <el-col :span="3" class="el-name">电话：</el-col>
          <el-col :span="4">15856593552</el-col>
        </el-row>
        <el-row class="el_t_20">
          <el-col :span="3" class="el-name">门诊号：</el-col>
          <el-col :span="6">1000215</el-col>
          <el-col :span="3" class="el-name">就诊时间：</el-col>
          <el-col :span="5">2018.12.13</el-col>
        </el-row>
        <el-row class="el_t_20">
          <el-col :span="3" class="el-name">备注：</el-col>
          <el-col :span="10" class="hidden">该患者喜好某某某，习惯某某某，两行显示，超出做缺省该患者喜好某某某，习惯某某某，两行显示，超出做缺省</el-col>
        </el-row>
      </div>
      <el-row class="edit-title el_t_20">
        <el-col :span="4">随访结果</el-col>
      </el-row>
      <el-form :model="info" :rules="rules" ref="info" label-width="130px" class="el_t_20">
        <el-form-item label="随访日期：" class="el_t_20" prop="name">
          <el-row>
            <el-col :span="8">
              <el-date-picker class="el_long" v-model="info.date" type="date" placeholder="请选择随访日期"></el-date-picker>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="随访方式：" prop="name">
          <el-radio-group v-model="info.radio">
            <el-radio :label="1">电话</el-radio>
            <el-radio :label="2">微信</el-radio>
            <el-radio :label="2">其他</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="随访结果：" prop="name">
          <el-row>
            <el-col :span="24">
              <el-input type="textarea" :rows="3"></el-input>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="下次随访日期：" class="el_t_20">
          <el-row>
            <el-col :span="8">
              <el-date-picker
                class="el_long"
                v-model="info.name"
                type="date"
                placeholder="请选择下次随访日期"
              ></el-date-picker>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="下次随访内容：">
          <el-row>
            <el-col :span="24">
              <el-input type="text" placeholder="请输入下次随访内容" :rows="3"></el-input>
            </el-col>
          </el-row>
        </el-form-item>
        <el-form-item label="随访方式：">
          <el-radio-group v-model="info.radio">
            <el-radio :label="1">电话</el-radio>
            <el-radio :label="2">微信</el-radio>
            <el-radio :label="2">其他</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <el-row class="footer-fixed">
        <el-col :span="24" class="text-right">
          <el-button type="primary" plain @click="deleteMsg">取 消</el-button>
          <el-button type="primary" @click="submitInfo('info')">保 存</el-button>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
export default {
  name: "edit",
  data() {
    return {
      info: {
        name: "",
        radio: 1,
        sex: "",
        date: new Date()
      },
      rules: {
        name: [
          { required: true, message: "医嘱名称不能为空", trigger: "blur" }
        ],
        radio: [
          { required: true, message: "请选择所属分类", trigger: "change" }
        ]
      },
      restaurants: [
        { value: "三全鲜食（北新泾店）", address: "长宁区新渔路144号" },
        {
          value: "Hot honey 首尔炸鸡（仙霞路）",
          address: "上海市长宁区淞虹路661号"
        },
        {
          value: "新旺角茶餐厅",
          address: "上海市普陀区真北路988号创邑金沙谷6号楼113"
        },
        { value: "泷千家(天山西路店)", address: "天山西路438号" }
      ]
    };
  },
  methods: {
    querySearch(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createFilter(queryString))
        : restaurants;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    handleSelect(item) {
      console.log(item);
    },
    submitInfo(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("验证通过！");
        } else {
          return false;
        }
      });
    },
    goBack() {
      this.$router.go(-1);
    },
    deleteMsg(data) {
      this.$confirm("确定删除该条记录？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "点错了",
        type: "warning"
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "取消成功!"
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消"
          });
        });
    }
  }
};
</script>
<style scoped>
.el_content {
  width: 100%;
  height: calc(100vh - 150px);
  background: #ffffff;
  padding: 20px;
}
.edit-title {
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e4e4;
  color: #006835;
  font-weight: 700;
}
.detail {
  font-size: 14px;
  color: #333;
  line-height: 40px;
}
.detail .el-name {
  color: #999;
  text-align: right;
  padding-right: 20px;
}
</style>


